﻿/**
 * 构造一个排列，使得相邻对恰好有k个升序
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;

using llt = long long;
using vi = vector<int>;
using vvi = vector<vi>;

int N, K;
vi A;

void proc(){
    A.clear(); A.reserve(N);
    for(int i=N-K;i<=N;++i)A.emplace_back(i);
    for(int i=N-K-1;i>=1;--i)A.emplace_back(i);
    for(auto i : A) cout << i << " ";
    cout << endl;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    int nofkase = 1;
    cin >> nofkase;
    while(nofkase--){
        cin >> N >> K; proc();
    }
    return 0;
}